Load data - LOW CONCENTRATION
raw <-
bind_rows(
read_excel(file.path("data", "20170517low_ND_data_export.xlsx"))
) %>%
select(File, Nr., Start, Rt, End, # filename and retention times
Ampl44=`Ampl 44`, Ampl45=`Ampl 45`, # amplitudes
Area44=`rIntensity 44`, Area45=`rIntensity 45`, # areas
Intensity=`Intensity All`, #peak intensities
R13C = `R 13C/12C`, d13C = `13C/12C` # ratio and delta values
)
Map peaks
### CHANGE MAPPING FILE NAME ###
data_matched <- map_peaks(raw, metadata_file = file.path("metadata", "old_standard_peaks_July20.xlsx"), quiet = FALSE)
## INFO: 408 peaks in 17 files successfully assigned.
Add standard values
standards <- read_excel(file.path("metadata", "gc_irms_indiana_A6.xlsx"))
data_w_stds <- data_matched %>%
filter(type == "standard", is_ref_peak == "no") %>%
left_join(standards, by = "compound") %>%
mutate(is_std = !is.na(true.d13C) | !is.na(true.d2H))
Evaluate standards
Visualize
data_w_stds %>%
ggplot() +
aes(x = true.d13C, y = d13C, color = File) +
geom_smooth(method = "lm", se = FALSE, alpha = 0.5) +
geom_point() +
theme_bw() +
theme(legend.position = "none")

Overview
std_corrections <-
data_w_stds %>%
group_by(File) %>%
do({
m <- lm(d13C ~ true.d13C, data = .)
data_frame(
offset = coefficients(m)[1],
slope = coefficients(m)[2],
delta_ref_CO = -offset/slope,
max_residual = max(summary(m)$residuals),
rss = sum(summary(m)$residuals^2),
r2 = summary(m)$r.squared
)
})
std_corrections %>% knitr::kable(d = 3)
isotope values check by rentention time
data_w_stds %>%
ggplot() +
aes(x = Rt, y = d13C, color = File) +
geom_point() +
theme_bw() +
theme(legend.position = "none")

ggplotly(ggplot2::last_plot() + theme(legend.position = "none"))
peak intensities check by rentention time
data_w_stds %>%
ggplot() +
aes(x = Rt, y = Intensity, color = File) +
geom_point() +
theme_bw() +
theme(legend.position = "none")

ggplotly(ggplot2::last_plot() + theme(legend.position = "none"))
Load data - HIGH CONCENTRATION
raw <-
bind_rows(
read_excel(file.path("data", "20170519high_ND_data_export.xlsx"))
) %>%
select(File, Nr., Start, Rt, End, # filename and retention times
Ampl44=`Ampl 44`, Ampl45=`Ampl 45`, # amplitudes
Area44=`rIntensity 44`, Area45=`rIntensity 45`, # areas
Intensity=`Intensity All`, #peak intensities
R13C = `R 13C/12C`, d13C = `13C/12C` # ratio and delta values
)
Map peaks
### CHANGE MAPPING FILE NAME ###
data_matched <- map_peaks(raw, metadata_file = file.path("metadata", "old_standard_peaks_high_July20.xlsx"), quiet = FALSE)
## INFO: 600 peaks in 25 files successfully assigned.
## WARNING: 68 peaks are unassigned or missing
## # A tibble: 68 × 22
## File Nr.
## <chr> <dbl>
## 1 1175__170520_A5_PTV_4_5_A5dilutionsTest_CO2_newVial_7ng@ul.dxf 12
## 2 1175__170520_A5_PTV_4_5_A5dilutionsTest_CO2_newVial_7ng@ul.dxf 14
## 3 1175__170520_A5_PTV_4_5_A5dilutionsTest_CO2_newVial_7ng@ul.dxf 16
## 4 1175__170520_A5_PTV_4_5_A5dilutionsTest_CO2_newVial_7ng@ul.dxf 18
## 5 1175__170520_A5_PTV_4_5_A5dilutionsTest_CO2_newVial_7ng@ul.dxf 20
## 6 1175__170520_A5_PTV_4_5_A5dilutionsTest_CO2_newVial_7ng@ul.dxf 22
## 7 1177__170520_A5_PTV_5_0_A5dilutionsTest_CO2_newVial_7ng@ul.dxf 10
## 8 1177__170520_A5_PTV_5_0_A5dilutionsTest_CO2_newVial_7ng@ul.dxf 12
## 9 1177__170520_A5_PTV_5_0_A5dilutionsTest_CO2_newVial_7ng@ul.dxf 14
## 10 1177__170520_A5_PTV_5_0_A5dilutionsTest_CO2_newVial_7ng@ul.dxf 16
## # ... with 58 more rows, and 20 more variables: Start <dbl>, Rt <dbl>,
## # End <dbl>, Ampl44 <dbl>, Ampl45 <dbl>, Area44 <dbl>, Area45 <dbl>,
## # Intensity <dbl>, R13C <dbl>, d13C <dbl>, compound <chr>,
## # is_ref_peak <chr>, map <chr>, Rt_target <dbl>, type <chr>,
## # process <chr>, notes <dbl>, depth <dbl>, n_matches <dbl>,
## # n_overlapping <dbl>
Add standard values
standards <- read_excel(file.path("metadata", "gc_irms_indiana_A6.xlsx"))
data_w_stds <- data_matched %>%
filter(type == "standard", is_ref_peak == "no") %>%
left_join(standards, by = "compound") %>%
mutate(is_std = !is.na(true.d13C) | !is.na(true.d2H))
Evaluate standards
Visualize
data_w_stds %>%
ggplot() +
aes(x = true.d13C, y = d13C, color = File) +
geom_smooth(method = "lm", se = FALSE, alpha = 0.5) +
geom_point() +
theme_bw() +
theme(legend.position = "none")

Overview
std_corrections <-
data_w_stds %>%
group_by(File) %>%
do({
m <- lm(d13C ~ true.d13C, data = .)
data_frame(
offset = coefficients(m)[1],
slope = coefficients(m)[2],
delta_ref_CO = -offset/slope,
max_residual = max(summary(m)$residuals),
rss = sum(summary(m)$residuals^2),
r2 = summary(m)$r.squared
)
})
std_corrections %>% knitr::kable(d = 3)
isotope values check by rentention time
data_w_stds %>%
ggplot() +
aes(x = Rt, y = d13C, color = File) +
geom_point() +
theme_bw() +
theme(legend.position = "none")

peak intensities check by rentention time
data_w_stds %>%
ggplot() +
aes(x = Rt, y = Intensity, color = File) +
geom_point() +
theme_bw() +
theme(legend.position = "none")

ggplotly(ggplot2::last_plot() + theme(legend.position = "none"))
Load data - VERY HIGH CONCENTRATION #1
raw <-
bind_rows(
read_excel(file.path("data", "20170526veryhigh_ND_data_export.xlsx"))
) %>%
select(File, Nr., Start, Rt, End, # filename and retention times
Ampl44=`Ampl 44`, Ampl45=`Ampl 45`, # amplitudes
Area44=`rIntensity 44`, Area45=`rIntensity 45`, # areas
Intensity=`Intensity All`, #peak intensities
R13C = `R 13C/12C`, d13C = `13C/12C` # ratio and delta values
)
Map peaks
### CHANGE MAPPING FILE NAME ###
data_matched <- map_peaks(raw, metadata_file = file.path("metadata", "old_standard_peaks_veryhigh_July20.xlsx"), quiet = FALSE)
## INFO: 628 peaks in 27 files successfully assigned.
## WARNING: 20 peaks are unassigned or missing
## # A tibble: 20 × 22
## File Nr.
## <chr> <dbl>
## 1 1189__170526_A5_PTV_0_5_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 2 1190__170526_A5_PTV_0_5_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 3 1191__170526_A5_PTV_0_5_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 4 1192__170526_A5_PTV_1_0_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 5 1193__170526_A5_PTV_1_0_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 6 1194__170526_A5_PTV_1_5_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 7 1195__170526_A5_PTV_1_5_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 8 1196__170526_A5_PTV_2_0_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 9 1197__170526_A5_PTV_2_0_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 10 1198__170527_A5_PTV_2_5_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 11 1199__170527_A5_PTV_2_5_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 12 1200__170527_A5_PTV_3_0_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 13 1201__170527_A5_PTV_3_0_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 14 1202__170527_A5_PTV_3_5_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 15 1203__170527_A5_PTV_3_5_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 16 1204__170527_A5_PTV_4_0_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 17 1205__170527_A5_PTV_4_0_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 18 1206__170527_A5_PTV_4_5_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 19 1214__170527_A5_PTV_0_5_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 20 1215__170527_A5_PTV_0_5_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## # ... with 20 more variables: Start <dbl>, Rt <dbl>, End <dbl>,
## # Ampl44 <dbl>, Ampl45 <dbl>, Area44 <dbl>, Area45 <dbl>,
## # Intensity <dbl>, R13C <dbl>, d13C <dbl>, compound <chr>,
## # is_ref_peak <chr>, map <chr>, Rt_target <dbl>, type <chr>,
## # process <chr>, notes <dbl>, depth <dbl>, n_matches <dbl>,
## # n_overlapping <dbl>
Add standard values
standards <- read_excel(file.path("metadata", "gc_irms_indiana_A6.xlsx"))
data_w_stds <- data_matched %>%
filter(type == "standard", is_ref_peak == "no") %>%
left_join(standards, by = "compound") %>%
mutate(is_std = !is.na(true.d13C) | !is.na(true.d2H))
Evaluate standards
Visualize
data_w_stds %>%
ggplot() +
aes(x = true.d13C, y = d13C, color = File) +
geom_smooth(method = "lm", se = FALSE, alpha = 0.5) +
geom_point() +
theme_bw() +
theme(legend.position = "none")

Overview
std_corrections <-
data_w_stds %>%
group_by(File) %>%
do({
m <- lm(d13C ~ true.d13C, data = .)
data_frame(
offset = coefficients(m)[1],
slope = coefficients(m)[2],
delta_ref_CO = -offset/slope,
max_residual = max(summary(m)$residuals),
rss = sum(summary(m)$residuals^2),
r2 = summary(m)$r.squared
)
})
std_corrections %>% knitr::kable(d = 3)
isotope values check by rentention time
data_w_stds %>%
ggplot() +
aes(x = Rt, y = d13C, color = File) +
geom_point() +
theme_bw() +
theme(legend.position = "none")

ggplotly(ggplot2::last_plot() + theme(legend.position = "none"))
peak intensities check by rentention time
data_w_stds %>%
ggplot() +
aes(x = Rt, y = Intensity, color = File) +
geom_point() +
theme_bw() +
theme(legend.position = "none")

ggplotly(ggplot2::last_plot() + theme(legend.position = "none"))
Load data - VERY HIGH CONCENTRATION #2
raw <-
bind_rows(
read_excel(file.path("data", "20170601veryhigh_ND_data_export.xlsx"))
) %>%
select(File, Nr., Start, Rt, End, # filename and retention times
Ampl44=`Ampl 44`, Ampl45=`Ampl 45`, # amplitudes
Area44=`rIntensity 44`, Area45=`rIntensity 45`, # areas
Intensity=`Intensity All`, #peak intensities
R13C = `R 13C/12C`, d13C = `13C/12C` # ratio and delta values
)
Map peaks
### CHANGE MAPPING FILE NAME ###
data_matched <- map_peaks(raw, metadata_file = file.path("metadata", "old_standard_peaks_veryhigh2_July20.xlsx"), quiet = FALSE)
## INFO: 272 peaks in 12 files successfully assigned.
## WARNING: 16 peaks are unassigned or missing
## # A tibble: 16 × 22
## File Nr.
## <chr> <dbl>
## 1 1222__170601_A5_PTV_0_5_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 2 1222__170601_A5_PTV_0_5_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 3 1223__170601_A5_PTV_1_0_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 4 1223__170601_A5_PTV_1_0_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 5 1224__170601_A5_PTV_1_5_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 6 1224__170601_A5_PTV_1_5_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 7 1225__170601_A5_PTV_2_0_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 8 1225__170601_A5_PTV_2_0_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 9 1226__170601_A5_PTV_2_5_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 10 1227__170601_A5_PTV_3_0_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 11 1228__170602_A5_PTV_3_5_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 12 1229__170602_A5_PTV_4_0_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 13 1230__170602_A5_PTV_4_5_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 14 1231__170602_A5_PTV_5_0_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 15 1232__170602_A5_PTV_5_5_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## 16 1233__170602_A5_PTV_6_0_A5dilutionsTest_CO2_newVial_14ng@ul.dxf NA
## # ... with 20 more variables: Start <dbl>, Rt <dbl>, End <dbl>,
## # Ampl44 <dbl>, Ampl45 <dbl>, Area44 <dbl>, Area45 <dbl>,
## # Intensity <dbl>, R13C <dbl>, d13C <dbl>, compound <chr>,
## # is_ref_peak <chr>, map <chr>, Rt_target <dbl>, type <chr>,
## # process <chr>, notes <dbl>, depth <dbl>, n_matches <dbl>,
## # n_overlapping <dbl>
Add standard values
standards <- read_excel(file.path("metadata", "gc_irms_indiana_A6.xlsx"))
data_w_stds <- data_matched %>%
filter(type == "standard", is_ref_peak == "no") %>%
left_join(standards, by = "compound") %>%
mutate(is_std = !is.na(true.d13C) | !is.na(true.d2H))
Evaluate standards
Visualize
data_w_stds %>%
ggplot() +
aes(x = true.d13C, y = d13C, color = File) +
geom_smooth(method = "lm", se = FALSE, alpha = 0.5) +
geom_point() +
theme_bw() +
theme(legend.position = "none")

Overview
std_corrections <-
data_w_stds %>%
group_by(File) %>%
do({
m <- lm(d13C ~ true.d13C, data = .)
data_frame(
offset = coefficients(m)[1],
slope = coefficients(m)[2],
delta_ref_CO = -offset/slope,
max_residual = max(summary(m)$residuals),
rss = sum(summary(m)$residuals^2),
r2 = summary(m)$r.squared
)
})
std_corrections %>% knitr::kable(d = 3)
isotope values check by rentention time
data_w_stds %>%
ggplot() +
aes(x = Rt, y = d13C, color = File) +
geom_point() +
theme_bw() +
theme(legend.position = "none")

ggplotly(ggplot2::last_plot() + theme(legend.position = "none"))
peak intensities check by rentention time
data_w_stds %>%
ggplot() +
aes(x = Rt, y = Intensity, color = File) +
geom_point() +
theme_bw() +
theme(legend.position = "none")

ggplotly(ggplot2::last_plot() + theme(legend.position = "none"))